In the Royal Navy of the 18th and 19th centuries a Captain of the Fleet could be appointed to assist an admiral when the admiral had ten or more ships to command.
This was a post rather than a rank in itself, and if its holder's permanent rank was below that of an admiral then he ranked just below the most junior rear-admiral and was entitled to the pay and allowance of a rear-admiral whilst he held the post.
The admiral's commands would be issued through his captain of the fleet, and the fleet's responses would be passed back to him. This role of intermediary between the overall commander and the commanded was analogous to that of a commander on a large warship, through whom orders were relayed to the crew and responses received. He would also act in some senses and instances as the admiral's chief of staff.
A captain of the fleet would usually be stationed on the admiral's flagship as its "First Captain", and so that ship would also have a flag captain or "2nd Captain" for everyday command of the ship itself.